import {Login} from './api/index'
// app.js
App({
  onLaunch() {
    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)

    // 登录
    wx.login({
      success: res => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
      }
    })
    this.globalData.count = wx.getStorageSync('count')||5;
    // 本地存储的数据什么格式都可以
    wx.login({
      success(res){
        Login({code:res.code})
        .then(res=>{
          // wx.setStorageSync('token', res.data.token);
          
          wx.setStorageSync('token', "93575a30bf040575c5ec57e032f94bf0");
          wx.setStorageSync('user', res.data.user);
        })
      }
    })
     
  },
  globalData: {
    userInfo: null,
    // 定义全局数据count
    count:5,
  }
})
